import Vue from 'vue'
import Router from 'vue-router'
import Main from '@/views/Main'

Vue.use(Router)

export const appRouter = [
  {
    path: '/',
    name: 'Main',
    component: Main,
    children:[
      { path: '/home',
        title: "首页",
        name: 'home_index',
        meta:{
          title: 'Home',
        },
        component: resolve => { require(['@/views/index.vue'], resolve); }
      },
      {
        path: '/login',
        name: 'Login',
        title: "登录",
        meta: {
          title: '登录'
        },
        component: resolve => {
          require(['@/views/main/login.vue'], resolve);
        }
      },
      {
        path: '/reg',
        name: 'Register',
        title: "注册",
        meta: {
          title: '注册'
        },
        component: resolve => {
          require(['@/views/main/register.vue'], resolve);
        }
      },
      {
        path: '/ueditor',
        name: 'Ueditor',
        title: "Ueditor",
        meta: {
          title: 'Ueditor'
        },
        component: resolve => {
          require(['@/views/ueditor/ueditor.vue'], resolve);
        }
      }
    ]
  },
  {
    path: '/art',
    name: 'Article',
    component: Main,
    children:[
      { path: '/art/index',
        title: "Article-list",
        name: 'article-list',
        meta:{
          title: 'Article-list',
        },
        component: resolve => { require(['@/views/article/index.vue'], resolve); }
      },
      { path: '/art/detail',
        title: "Article-detail",
        name: 'article-detail',
        meta:{
          title: 'Article-detail',
        },
        component: resolve => { require(['@/views/article/detail.vue'], resolve); }
      },
      { path: '/art/write',
        title: "Article-write",
        name: 'article-write',
        meta:{
          title: 'Article-write',
        },
        component: resolve => { require(['@/views/article/write.vue'], resolve); }
      },
    ]
  },
  {
    path: '/msg',
    name: 'Message',
    component: Main,
    children:[
      { path: '/msg/index',
        title: "Message-list",
        name: 'Message-list',
        meta:{
          title: 'Message-list',
        },
        component: resolve => { require(['@/views/msg/index.vue'], resolve); }
      },
      { path: '/msg/detail',
        title: "Message-detail",
        name: 'Message-detail',
        meta:{
          title: 'Message-detail',
        },
        component: resolve => { require(['@/views/msg/detail.vue'], resolve); }
      },
    ]
  },
  {
    path: '/fb',
    name: 'Feedback',
    component: Main,
    children:[
      { path: '/fb/index',
        title: "Feedback-list",
        name: 'Feedback-list',
        meta:{
          title: 'Feedback-list',
        },
        component: resolve => { require(['@/views/feedback/index.vue'], resolve); }
      },
      { path: '/fb/detail',
        title: "Feedback-detail",
        name: 'Feedback-detail',
        meta:{
          title: 'Feedback-detail',
        },
        component: resolve => { require(['@/views/feedback/detail.vue'], resolve); }
      },
      { path: '/fb/write',
        title: "Feedback-write",
        name: 'Feedback-write',
        meta:{
          title: 'Feedback-write',
        },
        component: resolve => { require(['@/views/feedback/write.vue'], resolve); }
      },
    ]
  },
]


// 路由配置
export const routers = new Router({
  routes: appRouter
});

// 路由拦截

export default routers
